package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Categoriav extends javax.swing.JFrame implements AbstractFactory{
	private JPanel panelcategoria;
	private JLabel lblnomcategoria;
	private JButton btnregistrar;
	private JTextField txtnomcategoria;
	private JTextField txtcodcategoria;
	private JButton btncancelar;
	private JLabel lblcodcategoria;
	

	/**
	* Auto-generated main method to display this JFrame
	*/
		
	public Categoriav() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setTitle("Registrar Categoria");
			{
				panelcategoria = new JPanel();
				getContentPane().add(panelcategoria, "Center");
				panelcategoria.setBounds(0, 0, 366, 211);
				panelcategoria.setLayout(null);
				panelcategoria.setToolTipText("Cancelar");
				{
					lblcodcategoria = new JLabel();
					panelcategoria.add(lblcodcategoria);
					lblcodcategoria.setText("Codigo de Categoria:");
					lblcodcategoria.setBounds(22, 87, 158, 15);
					lblcodcategoria.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					lblnomcategoria = new JLabel();
					panelcategoria.add(lblnomcategoria);
					lblnomcategoria.setText("Nombre de la Categoria:");
					lblnomcategoria.setBounds(12, 44, 182, 15);
					lblnomcategoria.setFont(new java.awt.Font("Bookman Uralic",2,14));
				}
				{
					btnregistrar = new JButton();
					panelcategoria.add(btnregistrar);
					btnregistrar.setText("Registrar");
					btnregistrar.setBounds(34, 127, 131, 54);
					btnregistrar.setFont(new java.awt.Font("Bookman Uralic",2,12));
					btnregistrar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen/cajareg.png")));
				}
				{
					btncancelar = new JButton();
					panelcategoria.add(btncancelar);
					btncancelar.setBounds(204, 127, 132, 53);
					btncancelar.setFont(new java.awt.Font("Bookman Uralic",2,12));
					btncancelar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen/48px-Crystal_Clear_action_stop.png")));
					btncancelar.setText("Cancelar");
				}
				{
					txtcodcategoria = new JTextField();
					panelcategoria.add(txtcodcategoria);
					txtcodcategoria.setBounds(201, 42, 97, 22);
				}
				{
					txtnomcategoria = new JTextField();
					panelcategoria.add(txtnomcategoria);
					txtnomcategoria.setBounds(192, 85, 153, 22);
				}
			}
			pack();
			this.setSize(376, 241);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	public void mensaje(String sms){
		JOptionPane.showMessageDialog(this,sms);
	}


	public void Limpiar() {
		txtcodcategoria.setText("");
		txtnomcategoria.setText("");
		
	}
	public String getCodigo(){
		return txtcodcategoria.getText();
	}
	public String getNombre(){
		return txtnomcategoria.getText();
	}
	public void addListener(ActionListener actionListener){
		btncancelar.addActionListener(actionListener);
		btnregistrar.addActionListener(actionListener);
	}

}
